<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise.prototype.then</title>
</head>

<body>
    <script>
        //创建promise对象
        const p = new Promise((resolve, reject) => {
            setTimeout(() => {
                resolve('用户数据');
            }, 1000)
        });
        //调用then方法
        p.then(value => {
            console.log(value);
        }, reason => {
            console.warn(reason);
        });
    </script>
</body>

</html>